/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package br.com.cotec.model;

import java.io.Serializable;
import java.util.List;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author magalhaes
 */
@Entity
@Table(name = "role_names")
@NamedQueries({@NamedQuery(name = "RoleNames.findAll", query = "SELECT r FROM RoleNames r"), @NamedQuery(name = "RoleNames.findById", query = "SELECT r FROM RoleNames r WHERE r.id = :id"), @NamedQuery(name = "RoleNames.findByDescription", query = "SELECT r FROM RoleNames r WHERE r.description = :description"), @NamedQuery(name = "RoleNames.findByName", query = "SELECT r FROM RoleNames r WHERE r.name = :name")})
public class RoleNames implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Long id;
    @Basic(optional = false)
    @Column(name = "description", length=45)
    private String description;
    @Basic(optional = false)
    @Column(name = "name", length=45)
    private String name;
    @ManyToMany(mappedBy = "roleNamesList")
    private List<Users> userList;

    public RoleNames() {

    }

    public RoleNames(Long id) {
        this.id = id;
    }

    public RoleNames(Long id, String description, String name) {
        this.id = id;
        this.description = description;
        this.name = name;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public List<Users> getUserList() {
        return userList;
    }

    public void setUserList(List<Users> userList) {
        this.userList = userList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof RoleNames)) {
            return false;
        }
        RoleNames other = (RoleNames) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "br.com.gt.model.RoleNames[id=" + id + "]";
    }

}
